package error;

import java.util.ArrayList;

public class OutOfMemory {
    public static void main(String[] args) {
//        test1();
        test2(1);
    }

    public static void test2(int i) {
        System.out.println(i);
        test2(i + 1);
    }

    public static void test1() {
        ArrayList<Byte[]> objects = new ArrayList<>();
        while (true) {
            objects.add(new Byte[1024 * 1024 * 1024]);
            System.out.println(objects.size());
        }
    }
}
